# config.py
import os
from dotenv import load_dotenv

# 加载环境变量
load_dotenv()

# 站点配置
SITES = [
    {
        "user": "吴罗平",
        "domain": "buchmistrz.pl",
        "url": "https://www.buchmistrz.pl",
        "consumer_key": "ck_75e405e4a60395d1b76aaebb1bf9cda39f53373a",
        "consumer_secret": "cs_7b4c64a2aa0681754d85a35100b70ddf562a33ca"
    },
    {
        "user": "吴辉",
        "domain": "strefajednorazowek.pl",
        "url": "https://www.strefajednorazowek.pl",
        "consumer_key": "ck_5ce4c80f4b4abe045c2ba3bbe3ca31525db1b101",
        "consumer_secret": "cs_0016d8fd65de3474b16879281804b6fc055b34f1"
    }
]

# 应用配置
class Config:
    ADMIN_USERNAME = os.getenv('ADMIN_USERNAME', 'admin')
    ADMIN_PASSWORD = os.getenv('ADMIN_PASSWORD', 'admin')
    DATABASE_URL = os.getenv("DATABASE_URL", "sqlite:///database.db")
    
    # 钉钉机器人（可选）
    DINGTALK_WEBHOOK = os.getenv("DINGTALK_WEBHOOK")
    DINGTALK_SECRET = os.getenv("DINGTALK_SECRET")  # 钉钉机器人签名密钥
    
    # 邮件告警（可选）
    SMTP_HOST = os.getenv("SMTP_HOST")
    SMTP_PORT = int(os.getenv("SMTP_PORT", 587))
    SMTP_USER = os.getenv("SMTP_USER")
    SMTP_PASS = os.getenv("SMTP_PASS")
    NOTIFY_EMAILS = [e.strip() for e in os.getenv("NOTIFY_EMAILS", "").split(",") if "@" in e]
    EMAIL_SUBJECT_PREFIX = os.getenv("EMAIL_SUBJECT_PREFIX", "[订单]")